﻿@model List<TJBHJJ.Models.Product>

@{
    ViewBag.Title = "案例列表";
    int pagecount = (int)ViewData["pageCount"];
    int pageindex = (int)ViewData["pageIndex"];
}

<table>
    <tr>
        <td>
            案例名称
        </td>
        <td>
            描述
        </td>
        <td>
            修改
        </td>
        <td>
            删除
        </td>
    </tr>
    @foreach (var v in Model)
    {
        <tr>
            <td>
                @(v.Name.Length > 13 ? v.Name.Substring(0, 13) + "..." : v.Name)
            </td>
            <td>@(v.Descriptions.Length > 30 ? v.Descriptions.Substring(0, 30) + "..." : v.Descriptions)
            </td>
            <td>@Html.ActionLink("修改", "EditProduct", new { page = pageindex, id = v.Id })
            </td>
            <td>@Html.ActionLink("删除", "DeleteProduct", new { page = pageindex, id = v.Id }, new { onclick = "return confirm('确认删除吗？')" })
            </td>
        </tr>
    }
    <tr>
        <td colspan="3" align="center">
            @Html.ActionLink("[首页]", "ListProduct", new { page = 0 })
            @for (int i = 1; i < pagecount; i++)
            {
                if (i == pageindex)
                {
                <strong style="color: Red;">@Html.ActionLink("[" + i + "]", "ListProduct", new { page = i })</strong>
                }
                else
                {
                @Html.ActionLink("[" + i + "]", "ListProduct", new { page = i })
                }
            }
            @Html.ActionLink("[末页]", "ListProduct", new { page = pagecount })
        </td>
    </tr>
    <tr>
        <td colspan="4">
            @Html.ActionLink("添加案例", "AddProduct")

        </td>
    </tr>
</table>